package org.dna.wickwtui.jobs;

import java.util.List;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PageableListView;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
//import org.dna.metronomo.persistence.Job;

/**
 * Displays the list of jobs passed into, invoked by a details link in the activities
 * list panel.
 * */
public class JobListPanel extends Panel {

    private static final long serialVersionUID = 7273740355903637758L;
    private static final int ITEM_PER_PAGE = 20;

    @SuppressWarnings({"serial", "unchecked"})
    public JobListPanel(String id/*, List<IModel<Job>> jobs*/) {
        super(id);
//        PageableListView jobsView = new PageableListView("jobs", jobs, ITEM_PER_PAGE) {
//
//            @Override
//            protected void populateItem(ListItem item) {
//                IModel<Job> jobModel = (IModel<Job>) item.getModelObject();
//                item.setModel(new CompoundPropertyModel<Job>(jobModel));
//
//                // TODO add the checkbox
//                Job job = jobModel.getObject();
//                Link link = new Link("link", jobModel) {
//
//                    @Override
//                    public void onClick() {
//                        setResponsePage(new ManageJobPage(
//                                (Job) getModelObject()));
//                    }
//                };
//                link.add(new Label("name"));
//                item.add(link);
//                item.add(new MultiLineLabel("description"));
//                item.add(new Label("duration", job.getElapsed().toString()));
//                // // item.add(new DeleteLink("delete", item.getModel()));
//            }
//        };
//        add(jobsView);
//        add(new PagingNavigator("navigator", jobsView));
    }
}
